#include "numspin.h"
#include "ui_numspin.h"

NumSpin::NumSpin(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::NumSpin)
{
    ui->setupUi(this);

    // Spinbox 动，Slider跟着动

   //[signal] void QSpinBox::valueChanged(int i)
   void (QSpinBox:: *spinValueChanged)(int) = &QSpinBox::valueChanged;
   connect(ui->spinBox, spinValueChanged, ui->horizontalSlider, &QSlider::setValue);

   // 动，Slider动 Spinbox 数字改变

  //[signal] void QSpinBox::valueChanged(int i)
  connect(ui->horizontalSlider, &QAbstractSlider::valueChanged, ui->spinBox, &QSpinBox::setValue);
}

NumSpin::~NumSpin()
{
    delete ui;
}

int NumSpin::getNum()
{
    return ui->spinBox->value();
}

void NumSpin::setNum(int num)
{
     return ui->spinBox->setValue(num);
}
